#ifndef PARSERINTERFACE_H
#define PARSERINTERFACE_H

#include <stdio.h>
#include <string>

class ParserInterface
{
    public:
        ParserInterface();
        virtual ~ParserInterface();

        void setInputString(const char* input, int len);
        void setInputString(const std::string& input);

        virtual void prolog();
        virtual void epilog();
        virtual void rewind_stream();

        void getChar();
        bool isEqual(char ch) const;
        bool isEOF() const;
        bool isDot() const;
        bool isUnderscore() const;
        bool isLetter() const;
        bool isLetterOrDigit() const;
        bool isWhitespace() const;
        virtual void skipWhite();
        virtual void skipToChar (char ch);
		virtual void skipToString (const std::string& str);
        virtual bool match(char ch);
        virtual bool matchString(const std::string& str);
        virtual void expected(const std::string& str);

        virtual std::string name();

        const char* current();
        int remainCharsNum() const;

        static std::string trimLeft_const(std::string str);
        static void trimLeft_mutable(std::string& str);
        static std::string trimRight_const(std::string str);
        static void trimRight_mutable(std::string& str);
        static std::string trim_const(std::string str);
        static void trim_mutable(std::string& str);

    public:
        const char* mInput;
        int mLen;  // the index of the last character in input string
        int mCurr; // the current index of the character which just have been read into

    protected:

    private:
};

#endif // PARSERINTERFACE_H
